const express = require("express")
const app = express()

const lagou_cookie = require("./get_cookie") 

// const baidu_fanyi = require("./baidu_fanyi") 
// const youdao_fanyi = require("./youdao_fanyi") 

var bodyParser = require("body-parser")
app.use(bodyParser())

// app.post('/baidu_sign',function (req, res) {  //有道翻译
//     let result = req.body  
//     console.log("result",result)
//     let args = result.args
//     let s = baidu_fanyi.get_sign(args)
//     res.send(s);
// })

// app.post('/youdao_sign',function (req, res) {  // 有道翻译
//     let result = req.body
//     console.log("result",result)
//     let args = result.args
//     let s = youdao_fanyi.get_sign(args)
//     res.send(s);
// })

app.post('/lagou',function (req, res) {  //有道翻译
    let result = req.body  
    console.log("result",result)
    let ts = result.ts;
    let name = result.name;
    let seed = result.seed;
    let js_token = result.js_token;

    let lg_stoken = lagou_cookie.get_cookie(ts,seed,js_token,name)
    console.log("lg_stoken= ",lg_stoken)
    res.send(lg_stoken)
})



app.listen(8900,() => {
    console.log("开启服务，端口8900")
})
